fix: fall back to default format index on malformed style index (#355) - #1059
Open
Mikkey-f wants to merge 1 commit into
Open
fix: fall back to default format index on malformed style index (#355)#1059Mikkey-f wants to merge 1 commit into
Mikkey-f wants to merge 1 commit into
Conversation
skytin1004
approved these changes
Sep 6, 2026
skytin1004
left a comment
Contributor
There was a problem hiding this comment.
Reviewed and verified locally.
The focused tests pass locally (4 tests). I also temporarily reverted the handler change and confirmed that the end-to-end test reproduces the original NumberFormatException in CellTagHandler.
The fix is narrowly scoped, and the regression coverage verifies both the internal handler and the public read path. I also confirmed that valid numeric style indexes are still handled through the existing lookup path, so the change does not affect the normal style lookup behavior.
LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #355
What changes were proposed in this pull request?
CellTagHandlerparses a cell'ssattribute (style index) with a bareInteger.parseInt. A non-numeric value — as produced by some third-party tools — threwNumberFormatExceptionand aborted the whole file read at the first corrupt cell (in the report: reading stopped at row 3218 of 3000+ rows).The parse now falls back to the default format index (
0) onNumberFormatException: a corrupt style index only loses that cell's style info, while the cell value and all subsequent rows are still read. This follows the reporter's suggestion and matches POI's lenient behavior (POI reads the same file completely, with the corrupt cell read as empty).How was this patch tested?
CellTagHandlerTest(2 new unit tests): non-numericsfalls back todataFormatData(0)without throwing; numericskeeps the exact lookup.CorruptStyleIndexReadTest(new end-to-end test): a minimal hand-built xlsx whose middle row carriess="abc"is read completely — all 3 rows returned.NumberFormatException: For input string: "abc"); with the fix it passes.fesod-sheetsuite: 915/915 green.spotless:checkandjavadocpass.Notes